/**
 * 
 */
package com.swim.natatoriumorder.entity;

import org.hibernate.validator.constraints.NotBlank;
import org.hibernate.validator.constraints.Length;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonFormat;
import javax.validation.constraints.NotNull;

import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.JoinTable;
import com.jeesite.common.mybatis.annotation.JoinTable.Type;
import com.jeesite.common.mybatis.annotation.Table;
import com.swim.natatoriumgoods.entity.NatatoriumGoods;
import com.swim.natatoriuminfo.entity.NatatoriumInfo;

/**
 * 游泳馆订单Entity
 * @author tql
 * @version 2021-03-14
 */
@Table(name="t_natatorium_order", alias="a", columns={
		@Column(name="id", attrName="id", label="唯一标识", isPK=true),
		@Column(name="order_num", attrName="orderNum", label="订单号"),
		@Column(name="natatorium_good_id", attrName="natatoriumGoodId", label="商品id"),
		@Column(name="natatorium_info_id", attrName="natatoriumInfoId", label="游泳馆id"),
		@Column(name="sys_user_id", attrName="sysUserId", label="付款人id"),
		@Column(name="payer_phone", attrName="payerPhone", label="付款人手机号"),
		@Column(name="pay_type", attrName="payType", label="支付方式"),
		@Column(name="pay_number", attrName="payNumber", label="支付单号"),
		@Column(name="pay_date", attrName="payDate", label="支付时间"),
		@Column(name="buy_number", attrName="buyNumber", label="购买数量"),
		@Column(name="should_pay", attrName="shouldPay", label="应付"),
		@Column(name="actual_pay", attrName="actualPay", label="实付"),
		@Column(name="actual_handle", attrName="actualHandle", label="实收"),
		@Column(name="should_settlement", attrName="shouldSettlement", label="可结算金额"),
		@Column(name="actual_settlement", attrName="actualSettlement", label="已结算金额"),
		@Column(name="settlement_status", attrName="settlementStatus", label="结算状态"),
		@Column(name="order_status", attrName="orderStatus", label="订单状态"),
		@Column(name="settlement_code", attrName="settlementCode", label="核算验证码"),
		@Column(name="verify_person", attrName="verifyPerson", label="核算人名"),
		@Column(name="verify_date", attrName="verifyDate", label="核算时间"),
		@Column(includeEntity=DataEntity.class),
	},  joinTable={
			@JoinTable(type=Type.LEFT_JOIN, entity=NatatoriumGoods.class, alias="ng", on="a.natatorium_good_id = ng.id", attrName="natatoriumGoods", 
					columns={
							@Column(includeEntity=NatatoriumGoods.class)					
					}),
			@JoinTable(type=Type.LEFT_JOIN, entity=NatatoriumInfo.class, alias="ni", on="a.natatorium_info_id = ni.id", attrName="natatoriumInfo", 
					columns={
							@Column(includeEntity=NatatoriumInfo.class),
					}),
	}, orderBy="a.update_date DESC"
)
public class NatatoriumOrder extends DataEntity<NatatoriumOrder> {
	
	private static final long serialVersionUID = 1L;
	private String orderNum;		// 订单号
	private String natatoriumGoodId;		// 商品id
	private String natatoriumInfoId;		// 游泳馆id
	private String sysUserId;		// 付款人id
	private String payerPhone;		// 付款人手机号
	private String payType;		// 支付方式
	private String payNumber;		// 支付单号
	private Date payDate;		// 支付时间
	private Long buyNumber;		// 购买数量
	private Double shouldPay;		// 应付
	private Double actualPay;		// 实付
	private Double actualHandle;		// 实收
	private Double shouldSettlement;		// 可结算金额
	private Double actualSettlement;		// 已结算金额
	private Long settlementStatus;		// 结算状态 1表示可结算(专指游泳票) 2表示不可结算 3表示可结算首款 4表示可结算尾款 5表示已结算首款 6表示已结算
	private Long orderStatus;		// 订单状态 1表示付款中 2表示已付款 3表示已核销 4表示已关闭
	private String settlementCode;		// 核算验证码
	private String verifyPerson;		// 核算人名
	private Date verifyDate;		// 核算时间
	private List<OrderStudent> orderStudentList = new ArrayList<OrderStudent>();//订单学员 实体 集合
	private String orderStudentListStr;
	
	private NatatoriumGoods natatoriumGoods;//游泳馆商品 实体
	private NatatoriumInfo natatoriumInfo;//游泳馆信息 实体
	
	//################ 附加属性 ##############
	private Long goodsType;		// 商品类型 1表示游泳票 2表示培训课程
	
	
	public NatatoriumOrder() {
		this(null);
	}

	public NatatoriumOrder(String id){
		super(id);
	}
	
	public Long getGoodsType() {
		return goodsType;
	}

	public void setGoodsType(Long goodsType) {
		this.goodsType = goodsType;
	}

	public String getPayerPhone() {
		return payerPhone;
	}

	public void setPayerPhone(String payerPhone) {
		this.payerPhone = payerPhone;
	}

	public NatatoriumInfo getNatatoriumInfo() {
		return natatoriumInfo;
	}

	public void setNatatoriumInfo(NatatoriumInfo natatoriumInfo) {
		this.natatoriumInfo = natatoriumInfo;
	}

	public List<OrderStudent> getOrderStudentList() {
		return orderStudentList;
	}

	public void setOrderStudentList(List<OrderStudent> orderStudentList) {
		this.orderStudentList = orderStudentList;
	}

	public String getOrderStudentListStr() {
		return orderStudentListStr;
	}

	public void setOrderStudentListStr(String orderStudentListStr) {
		this.orderStudentListStr = orderStudentListStr;
	}

	public NatatoriumGoods getNatatoriumGoods() {
		return natatoriumGoods;
	}

	public void setNatatoriumGoods(NatatoriumGoods natatoriumGoods) {
		this.natatoriumGoods = natatoriumGoods;
	}

	public String getOrderNum() {
		return orderNum;
	}

	public void setOrderNum(String orderNum) {
		this.orderNum = orderNum;
	}

	public Long getSettlementStatus() {
		return settlementStatus;
	}

	public void setSettlementStatus(Long settlementStatus) {
		this.settlementStatus = settlementStatus;
	}

	public Long getOrderStatus() {
		return orderStatus;
	}

	public void setOrderStatus(Long orderStatus) {
		this.orderStatus = orderStatus;
	}

	@NotBlank(message="商品id不能为空")
	@Length(min=0, max=64, message="商品id长度不能超过 64 个字符")
	public String getNatatoriumGoodId() {
		return natatoriumGoodId;
	}

	public void setNatatoriumGoodId(String natatoriumGoodId) {
		this.natatoriumGoodId = natatoriumGoodId;
	}
	
	@NotBlank(message="游泳馆id不能为空")
	@Length(min=0, max=64, message="游泳馆id长度不能超过 64 个字符")
	public String getNatatoriumInfoId() {
		return natatoriumInfoId;
	}

	public void setNatatoriumInfoId(String natatoriumInfoId) {
		this.natatoriumInfoId = natatoriumInfoId;
	}
	
	@NotBlank(message="付款人id不能为空")
	@Length(min=0, max=64, message="付款人id长度不能超过 64 个字符")
	public String getSysUserId() {
		return sysUserId;
	}

	public void setSysUserId(String sysUserId) {
		this.sysUserId = sysUserId;
	}
	
	@NotBlank(message="支付方式不能为空")
	@Length(min=0, max=150, message="支付方式长度不能超过 150 个字符")
	public String getPayType() {
		return payType;
	}

	public void setPayType(String payType) {
		this.payType = payType;
	}
	
	public String getPayNumber() {
		return payNumber;
	}

	public void setPayNumber(String payNumber) {
		this.payNumber = payNumber;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss")
	public Date getPayDate() {
		return payDate;
	}

	public void setPayDate(Date payDate) {
		this.payDate = payDate;
	}
	
	@NotNull(message="购买数量不能为空")
	public Long getBuyNumber() {
		return buyNumber;
	}

	public void setBuyNumber(Long buyNumber) {
		this.buyNumber = buyNumber;
	}
	
	@NotNull(message="应付不能为空")
	public Double getShouldPay() {
		return shouldPay;
	}

	public void setShouldPay(Double shouldPay) {
		this.shouldPay = shouldPay;
	}
	
	public Double getActualPay() {
		return actualPay;
	}

	public void setActualPay(Double actualPay) {
		this.actualPay = actualPay;
	}
	
	public Double getActualHandle() {
		return actualHandle;
	}

	public void setActualHandle(Double actualHandle) {
		this.actualHandle = actualHandle;
	}
	
	public Double getShouldSettlement() {
		return shouldSettlement;
	}

	public void setShouldSettlement(Double shouldSettlement) {
		this.shouldSettlement = shouldSettlement;
	}
	
	public Double getActualSettlement() {
		return actualSettlement;
	}

	public void setActualSettlement(Double actualSettlement) {
		this.actualSettlement = actualSettlement;
	}
	
	public String getSettlementCode() {
		return settlementCode;
	}

	public void setSettlementCode(String settlementCode) {
		this.settlementCode = settlementCode;
	}
	
	public String getVerifyPerson() {
		return verifyPerson;
	}

	public void setVerifyPerson(String verifyPerson) {
		this.verifyPerson = verifyPerson;
	}
	
	public Date getVerifyDate() {
		return verifyDate;
	}

	public void setVerifyDate(Date verifyDate) {
		this.verifyDate = verifyDate;
	}
	
}